
lst = [27, 48, 15, 37, 48, 29, 83, 97]

# 快速排序
def fast(lst):
    if len(lst)<2:
        return lst
    else:
        left = []
        right = []
        mid = [lst[0]]
        for i in range(1,len(lst)):
            if lst[0] > lst[i]:
                left.append(lst[i])
            elif lst[0] < lst[i]:
                right.append(lst[i])
            else:
                mid.append(lst[i])
        left = fast(left)
        right = fast(right)
        return left+mid+right


print(fast(lst))

